export default {
	setCache(key, value, expireSeconds) {
		const currentTime = Date.now();
		const expireTime = currentTime + expireSeconds * 1000; // 转换为毫秒
		uni.setStorage({
			key: key,
			data: {
				value: value,
				expireTime: expireTime
			}
		});
	},
	getCache(key) {
		const res = uni.getStorageSync(key);
		if (res && res.expireTime > Date.now()) {
			return res.value;
		} else {
			uni.removeStorage({
				key: key
			});
			return null; // 缓存过期，返回null
		}
	},
	removeCache(key) {
		uni.removeStorage({key:key})
	}
}